<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
</head>
<body>
<form action="#">
    <p>

        <span>用户名：</span> <input type="text" id="username" required>
    </p>
    <p>
        <span>性别：</span>
        <input type="radio" name="sex" value="male">男
        <input type="radio" name="sex" value="female">女
    </p>
    <input type="submit">

</form>
<script>
   var input_text = document.getElementById('username');
   input_text.value;
</script>
</body>
</html>